package com.app.ryjy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 公开联系方式标识枚举
 */
@AllArgsConstructor
@Getter
public enum PublicContactEnum {
    // 否
    NO("否", 0, -1),
    // 是
    YES("是", 1, -1);

    private final String desc;
    private final int code;
    private final int bizCode;

    /**
     * 根据 bizCode 获取 code
     *
     * @param bizCode bizCode
     * @return code
     */
    public static int getCodeByBizCode(int bizCode) {
        for (PublicContactEnum status : values()) {
            if (status.getBizCode() == bizCode) {
                return status.getCode();
            }
        }
        throw new RuntimeException("bizCode 不存在");
    }

    public static void main(String[] args) {
        System.out.println(PublicContactEnum.getCodeByBizCode(-1));
    }
}